//
//  DoctorDetailsView.m
//  QuickCure1
//
//  Created by summer的Dad on 16/11/1.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "DoctorDetailsView.h"
@interface DoctorDetailsView ()
//头像
@property(nonatomic,weak)UIImageView* iv_imageView;
//名字
@property(nonatomic,weak)UILabel * leb_title;
//副标题
@property(nonatomic,weak)UILabel * leb_disease;
//时间
@property(nonatomic,weak)UILabel * leb_time;
//预约
@property(nonatomic,weak)UILabel * leb_appointment;

@end
@implementation DoctorDetailsView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        
        [self setupUI];
        //切角图片
        self.iv_imageView.layer.cornerRadius = 50;
        self.iv_imageView.layer.masksToBounds = YES;
        //切角预约
        self.leb_appointment.layer.cornerRadius = 27.5;
        self.leb_appointment.layer.masksToBounds = YES;
        
        
    }
    return self;
}
#pragma mark
#pragma mark - mdoel
- (void)setModel:(DoctorApplyListModel *)model
{
    _model = model;
//    self.leb_appointment.text = self.model.checkType;
  
}
#pragma mark
#pragma mark - 赋值
- (void)setLb_str:(NSString *)lb_str
{
    _lb_str = lb_str;
    if ([lb_str containsString:@"审核中"]) {
       
        self.leb_appointment.backgroundColor = [UIColor colorWithRed:121/255.0 green:253/255.0 blue:254/255.0 alpha:1];
    }
    else
    {
        self.leb_appointment.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1];
    }
        self.leb_appointment.text = lb_str;
}

#pragma mark
#pragma mark - 搭建界面;
- (void)setupUI
{
    

    //创建View
    UIImageView* iv_imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cangcang"]];
 
    
    [self addSubview: iv_imageView];
    _iv_imageView = iv_imageView;
    [iv_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.leading.bottom.equalTo(self);
        make.width.height.equalTo(@100);
        
    }];
    //lebelTile
    UILabel* lebTitle = [self setLeble];
    lebTitle.text = @"王先生";
    lebTitle.font = [UIFont systemFontOfSize:17];
    lebTitle.textColor = [UIColor colorWithWhite:0.1 alpha:1];
    [self addSubview:lebTitle];
    _leb_title = lebTitle;
    //约束
    [lebTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(8);
        make.leading.mas_equalTo(self.iv_imageView.mas_trailing).offset(8);
    }];
    
    //leble
    UILabel* leb_disease = [self setLeble];
    leb_disease.text = @"高血压";
    [self addSubview:leb_disease];
    _leb_disease = leb_disease;
    
    [leb_disease mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lebTitle.mas_centerY);
        make.left.equalTo(self.leb_title.mas_right).offset(8);
    }];
    //lebleTime
    UILabel* leb_time = [self setLeble];

    _leb_time = leb_time;
    leb_time.text = @"老师机带带我!";
    [self addSubview:leb_time];
    [leb_time mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.leb_title.mas_leading);
        make.bottom.equalTo(self.mas_bottom).offset(-8);
        
    }];
    //leble
    UILabel* leb_appointment = [self setLeble];
    leb_appointment.font = [UIFont systemFontOfSize:17];
    leb_appointment.textColor = [UIColor colorWithWhite:0.7 alpha:1];
//    leb_appointment.text = @"审核中";
    leb_appointment.backgroundColor = [UIColor colorWithRed:64/255.0 green:192/255.0 blue:190/255.0 alpha:1];
    leb_appointment.textAlignment = NSTextAlignmentCenter;
    
    _leb_appointment = leb_appointment;
    [self addSubview:leb_appointment];
    [leb_appointment mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.trailing.equalTo(self).offset(-20);
        make.width.height.equalTo(@55);
    }];
    
    [self layoutIfNeeded];

 
    
    
}

#pragma mark
#pragma mark - 创建leble
- (UILabel*)setLeble
{
    
    UILabel* leble = [[UILabel alloc] init];
    leble.font = [UIFont systemFontOfSize:15];
    leble.textColor = [UIColor colorWithWhite:0.8 alpha:1];
   return leble;
}
@end
